import * as http from 'http';


const hostname = '127.0.0.1';
const port = 3000;

/** 创建服务器，参数为请求处理函数 */
const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'application/json');
  res.end(
 `{
      "a":123,
      "b":345
  }`);
});

/** 服务器开始监听，调用钩子 */
server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});